import axios from "@/axios"
import type {TShopList} from "@/types";
import {type Ref, ref} from "vue";

export default function () {
    async function getData(current = 1, search?: string, filter?: 'hot' | 'sale') {
        let data: Ref<TShopList> = ref([])
        await axios({
            url: '/goods/list',
            method: 'GET',
            data: {
                current,
                search,
                filter
            }
        }).then(r => {
            data.value = r.data.list
        })
        return data
    }
    return {getData}
}